import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TitleWrapVO, TitleWrapForm, TitleWrapQuery } from '@/api/advertisement/titleWrap/types';

/**
 * 查询标题包列表
 * @param query
 * @returns {*}
 */

export const listTitleWrap = (query?: TitleWrapQuery): AxiosPromise<TitleWrapVO[]> => {
  return request({
    url: '/oce/titleWrap/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询标题包详细
 * @param id
 */
export const getTitleWrap = (id: string | number): AxiosPromise<TitleWrapVO> => {
  return request({
    url: '/oce/titleWrap/' + id,
    method: 'get'
  });
};
export const getTitleWrapList = (data: string | number): AxiosPromise<TitleWrapVO> => {
  return request({
    url: '/oce/titleWrap/listTitle',
    method: 'get',
    params: data
  });
};
/**
 * 新增标题包
 * @param data
 */
export const addTitleWrap = (data: TitleWrapForm) => {
  return request({
    url: '/oce/titleWrap',
    method: 'post',
    data: data
  });
};

/**
 * 修改标题包
 * @param data
 */
export const updateTitleWrap = (data: TitleWrapForm) => {
  return request({
    url: '/oce/titleWrap',
    method: 'put',
    data: data
  });
};

/**
 * 删除标题包
 * @param id
 */
export const delTitleWrap = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oce/titleWrap/' + id,
    method: 'delete'
  });
};

/**
 * 保存标题包下的标题
 * @param data
 */
export const saveWrapTitle = (data: TitleWrapForm) => {
  return request({
    url: '/oce/titleWrap/updateWrapTitle',
    method: 'post',
    data: data
  });
};
